# 发布会接口对象层
from utils.SendMethod import SendMethod


class Event:
    def __init__(self):
        self.url = 'http://127.0.0.1:8000'

    # 添加发布会
    def add_event(self, payload):
        method = 'post'
        url = self.url + '/api/add_event/'
        return SendMethod.send_method(method, url, data=payload)

    # 查询发布会
    def get_event(self, eid=None, name=None):
        method = 'get'
        url = self.url + '/api/get_event_list/'
        params = {
            "eid": eid,
            "name": name
        }
        return SendMethod.send_method(method, url, params=params)


if __name__ == '__main__':
    body = {
        'eid': '889',
        'name': '苹果6688gg',
        'limit': '20',
        'status': '1',
        'address': '源码时代',
        'start_time': '2022-7-20'
    }
    # print(Event().add_event(body))
    print(Event().get_event(eid='557', name='苹果14ss'))
